int main(argc, argv){

  SafePoint("firehose-setup"); 
  
  Object *o = NULL;
  Object *p = NULL;
  Object *q = NULL; 

  initConstants(o,p,q);/*Same values for each run - from config file, say*/
  
  initFirehose(o,p,q);/*results in firehoseState == Firehose.valid*/
  
  bool lastEvent = false;/*flag - ends loop*/

  sendFireHoseInitMessage();
  /*Browning out any time before this, it would just be better to
    start from beginning of main, than to complicate this code.
    After this, though, we've started processing events, so it's better
    to not brown out to start of main*/

  SafePoint("post-init");/*We can run away and go here if the device 
                           delivering events disappears or changes*/
  while( !lastEvent ){
      lastEvent = handleEvent();
  } 

}

void handleEvent(){

  /*Default: Stuff is preserved across failures.  Illusion of continuity*/

  /*This is confusing.  We can do better than this.  Here's what it means:
    e is a pointer to an event (Event *).  e is stored on the stack;  *e is an event
    that will be on the heap.  

    The default for stack & reg is that they are preserved.  The default for 
    heap is that it is not preserved.  So we need to tell the system that
    this is a preserved Event pointed to by a plain
    old stack thing that is preserved by default. 

    Deeply unsatisfying.  Programmer: "How do i know what to preserve???  Everything???"
  */

  Try{

    Event __attribute__((preserved)) *e;

    SensorValue __attribute__((preserved)) *sval; 

    SensorState sstate; 

    e = getEventFromFirehose();/*from an external object fountain*/

    if( e->onTheHour == true ){

      sstate = getSensorState();

      if( sstate == SensorState.valid ){

        sval = getOnTheHourSensorReading();   

        int d = sval.asInt() / 12;

        if( d == MAX ){

          return true;

        }else{

          return false;

        }

      }else{

        return false;

      }

    }else{

      return false;

    }

  }Recover{

    /*If the "firehose" event fountain device is invalid now, we need to go
      allllllll the way back to the beginning to reinitialize that sucker*/ 
    if( firehoseState != Firehose.valid  ){ bailTo("firehose-setup"); }

    /*The purpose here is simple: if the death is short, continue.  If it is long,
      back to the start of the event loop.  The worst we have to do is go back
      to the point where we've initialized the system, though, never to main */
    if( currentTime - sval.time > sensor.SameTimeThreshold ){ bailTo("post-init"); }
    
    /*if the time is close enough, then we can just go back to where we failed via
      the "current" checkpoint.  That checkpoint is implied by the use of Try/Recover*/ 
    //Implied "bailTo("current-checkpoint")"

  }

}
